<?php
/**
 * Created by PhpStorm.
 * User: zhao shou qiang
 * Date: 2018/1/5 0005
 * Time: 09:56
 */
use yii\widgets\LinkPager;
use yii\helpers\Html;
use yii\helpers\Url;
use backend\controllers\DtActionFilter;

$project_state = Yii::$app->params['project_state'];

?>
<style type="text/css">
    .wrap {
        margin-top: 104px !important;
    }

    .jinDiaoTitle {
        font-size: 14px;
        font-weight: 100;
        color: #fff;
        margin: 60px 0px 20px 0;
        background: #63b4f5;
        border: none;
        padding: 3px 10px;
        cursor: pointer;
        border-radius: 2px;
        margin-left: 10px;
    }

    .assetPackage2 .row p {
        margin-top: 180px;
    }

    .details {
        overflow: hidden;
    }
    
    /*//更新时间*/
	.GTime {
	    text-align: right;
	    padding-right: 30px;
	    height: 0px;
	    margin-top: -42px;
	}


</style>

<!-- 资产包详情 start -->
<div class="container details" style="padding-bottom: 0px;margin-top: 30px;">
    <div class="row">
        <div class="assetPackage col-md-8">
            <p class="details-nav">
                <span>办公查询 ></span>
                <span>查询检索 ></span>
                <span> 项目详情</span>
            </p>
            <!--<h1>江苏盐城产业投资有限公司转让亚信源债权资产包</h1>-->
            <h1><?php echo !empty($Base['borrower']) ? $Base['borrower'] : ''; ?>
                <?php
                switch ($projectModel['status']) {
                    case 4:
                        echo '<span class="jinDiaoTitle">' . $project_state[(string)$projectModel['status']] . '</span>';
                        break;
                    case 5:
                        echo '<span class="jinDiaoTitle">' . $project_state[(string)$projectModel['status']] . '</span>';
                        break;
                    default:
                        echo '';
                }
                ?>
                <!--<span class="jinDiaoTitle">尽调中</span>-->
            </h1>
            <p class="psmall">
                <span>本金 :
                    <strong><?php echo !empty($Base['principal']) ? \common\helps\formatMoney::format_money($Base['principal']) : ''; ?></strong>
                </span>
                <span>利息 :
                    <strong><?php echo !empty($Base['interest']) ? \common\helps\formatMoney::format_money($Base['interest']) : ''; ?></strong>
                </span>
                <span>项目编号：
                    <strong><strong><?php echo !empty($Base['code']) ? $Base['code'] : ''; ?></strong>
                </strong>
                </span>
                <span>省份地区：
                    <strong><strong><?php echo !empty($Base['country']) ? $Base['country'] : ''; ?></strong>
                </strong>
                </span>
            </p>
            <p class="psmall">
                隶属资产包：
                <strong class="dizhi">
                    <?php
                    if (DtActionFilter::checkProject('package_view', Yii::$app->request->get('package_id', 1))) {
                        ?>
                        <a target="_blank"
                           href="/package/detail-info?packageid=<?= Yii::$app->request->get('package_id', 1); ?>"><?= $packageName ?></a>
                        <?php
                    }else{
                        ?>
                        <?= $packageName ?>
                        <?php
                    }
                    ?>
                </strong>
            </p>
            <div class="col-md-12  col-sm-12 details-btns">
                <?php
                if (DtActionFilter::checkProject('project_like', $Base['id'])) {
                ?>
                <button type="button" class="btn btn-primary details-btn like" id="flow"
              
                        data="flow-<?php echo $Base['flow']; ?>-1" style="width: 112px;">
                    <?php echo ($Base['flow'] == 1) ? Html::img('@web/image/projectDetails/isfocus.png', ['id' => 'flow_img', 'class' => 'pull-left ']) : Html::img('@web/image/projectDetails/focus.png', ['id' => 'flow_img', 'class' => 'pull-left ']); ?>
       
                    <span class="pull-left"><?= ($Base['flow'] == 1) ?'已关注':'关注';?></span>
                </button>
                    <?php
                }
                ?>
                <?php
                if (DtActionFilter::checkProject('project_down', $Base['id'])) {
                ?>
                <button type="button" class="btn btn-default details-btn"
                        onclick="window.location.href='/project/project-down-load?projectid=<?php echo $Base['id']; ?>'">
                    <?php echo Html::img('@web/image/projectDetails/download.png', ['class' => 'pull-left']); ?>
                    <span class="pull-left  ">下载报告</span>
                </button>
                    <?php
                }
                ?>
                <?php
                if (DtActionFilter::checkProject('project_light', $Base['id'])) {
                ?>
                <button type="button" class="btn btn-default details-btn like" id="light_spot"
                        data="light_spot-<?php echo $Base['light_spot']; ?>-2">
                    <?php echo ($Base['light_spot'] == 1) ? Html::img('@web/image/projectDetails/isliangDian.png', ['id' => 'light_spot_img', 'class' => 'pull-left ']) : Html::img('@web/image/projectDetails/liangDian.png', ['id' => 'light_spot_img', 'class' => 'pull-left ']); ?>
                    <span class="pull-left  ">标记为亮点项目</span>
                </button>
                    <?php
                }
                ?>
                <?php
                if (DtActionFilter::checkProject('project_permissions', $Base['id'])) {
                ?>
                <button type="button" class="btn btn-default details-btn" data-toggle="modal" data-target="#myModal1">
                    <?php echo Html::img('@web/image/projectDetails/quanXian.png', ['class' => 'pull-left']); ?>
                    <span class="pull-left">修改访问权限</span>
                </button>
                    <?php
                }
                ?>
                <?php
                if (DtActionFilter::checkProject('project_team', $Base['id'])) {
                ?>
                <button type="button" class="btn btn-default details-btn" data-toggle="modal" data-target="#myModal2">
                    <?php echo Html::img('@web/image/projectDetails/tuanDui.png', ['class' => 'pull-left']); ?>
                    <span class="pull-left">配置团队</span>
                </button>
                    <?php
                }
                ?>
            </div>
        </div>

        <div class="col-md-4 assetPackage2">
            <!--<button class="btn btn-primary pull-right" style="opacity: 0;">尽调中</button>-->
            <div class="row">
                <div class="col-md-12 pull-right" style="padding-top: 70px;">
                    <!--<img class="bind_hover_card pull-right per1" data-toggle="popover" data-placement="auto left" data-trigger="hover" src="/image/assetPackage/per.png"  style="width: 47px;height: 47px;">
                    <img class="bind_hover_card pull-right per2" data-toggle="popover" data-placement="auto left" data-trigger="hover" src="/image/assetPackage/per.png"  style="width: 47px;height: 47px;">
    -->
                    <?php
                    $init_avatar = '/image/projectDetails/per.png';

                    //团队成员
                    if (!empty($teamInfo['teamXZR']) && is_array($teamInfo['teamXZR'])) {
                        foreach ($teamInfo['teamXZR'] as $k => $v) {
                            echo '<img  src="'.$v['avatar'].'" data-toggle="popover" data-placement="auto left" 
                        data-trigger="hover" class="pull-right bind_hover_card per2"  style="width: 47px;height: 47px;" data-original-title=""
                        title="'.$v['role'].'" realName="'.$v['department'].$v['realname'].'">';
                        }
                    }

                    //项目经理
                    if (!empty($teamInfo['teamFZR']) && is_array($teamInfo['teamFZR'])) {
                        foreach ($teamInfo['teamFZR'] as $k => $v) {
                            echo '<img  src="'.$v['avatar'].'" data-toggle="popover" data-placement="auto left" 
                        data-trigger="hover" class="pull-right bind_hover_card per2" style="width: 47px;height: 47px;" data-original-title=""
                        title="'.$v['role'].'" realName="'.$v['department'].$v['realname'].'">';
                        }
                    }

                    //项目总监
                    if (!empty($teamInfo['teamZJ']) && is_array($teamInfo['teamZJ'])) {
                        foreach ($teamInfo['teamZJ'] as $k => $v) {
                            echo '<img  src="'.$v['avatar'].'" data-toggle="popover" data-placement="auto left" 
                        data-trigger="hover" class="pull-right bind_hover_card per2" style="width: 47px;height: 47px;" data-original-title=""
                        title="'.$v['role'].'" realName="'.$v['department'].$v['realname'].'">';
                        }
                    }

                    ?>
                </div>
            </div>
        </div>
        
        <div class="row" class="">
                <p class="col-md-12 GTime" style="margin-top: -42px!important;"> <?= !empty($Base['updated_at'])?'更新时间&nbsp;:&nbsp;'.$Base['updated_at']:'更新时间: 暂无更新';?></p>
         </div>
    </div>
</div>
<!-- 资产包详情 start -->

<!-- 访问权限 start -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModal">
    <?php
    echo $this->render('modal/asset-project-editing-permissions', ['projectid' => $Base['id'], 'departments' => $Base['departments'], 'access' => $Base['access'], 'access_users_ids' => $Base['access_users_ids']]);//修改访问权限
    ?>
</div>
<!-- 访问权限 end -->

<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModal2">
    <?php
    //var_dump($team);exit;
    echo $this->render('modal/asset-project-editing-team', ['projectid' => $Base['id'], 'userChief' => $userChief, 'user' => $user, 'team' => $team, 'teamXZR' => $teamXZR, 'teamFZR' => $teamFZR, 'teamZJ' => $teamZJ]);
    ?>
</div>

<!-- Modal -->
<div class="modal fade modal-focus" id="myModalLabel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-body">
                <div class="modal-body-focus">
                    <img src="/image/assetPackage/smile.png">
                    <p class="focus">关注成功</p>
                    <p>有更新系统会第一时间通知您</p>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary btns-primary" data-dismiss="modal">确定</button>
            </div>
        </div>
    </div>
</div>



